package com.qiche.requestpram;

import com.qiche.aspect.Result;
import com.qiche.model.Subscribe;
import com.qiche.enums.ResultEnum;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
 * 保存预约 接口参数 封装类
 *
 * @author chendezhi
 * @date 2018/3/6 15:30
 */
@Data
public class SaveSubscribeURL {

    private Subscribe subscribe;

    /*private Long memberCarId;
    private Long customerCarId;*/
    private Long storeMemberCarId;

    private List<Long> productIds;

    public Result checkParam() {
        if (subscribe == null || productIds == null) {
            return Result.createByResultEnum(ResultEnum.PARAM_ERROR);
        }
        if (StringUtils.isEmpty(subscribe.getCarNum())
                || StringUtils.isEmpty(subscribe.getCustomerCarDesc())
                || subscribe.getMerchantId() == null
                || subscribe.getMerchantId() < 0) {
            return Result.createByResultEnum(ResultEnum.PARAM_ERROR);
        }
        if (productIds.size() == 0) {
            return Result.createByResultEnum(ResultEnum.PARAM_ERROR);
        }

       /* if (subscribe.getCustomerCarId() == null || subscribe.getCustomerCarId() <= 0) {
            return Result.createByResultEnum(ResultEnum.PARAM_ERROR);
        }*/


        return null;
    }

}
